<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    /* 分割线 */

    /* 使用:before :after进行简单的分割线操作 */

    .or {

      text-align: center;
      position: relative;
      margin: 0 auto;
      width: 500px;
    }

    .or:after,
    .or:before {
      content: '';
      position: absolute;
      background-color: #ccc;
      width: 220px;
      height: 1px;
      top: 12px;
    }

    .or:before {
      left: 0;
    }

    .or:after {
      right: 0;
    }

    /* 动态添加类达到遮挡的效果 */

    .reg {
      width: 200px;
      height: 200px;
      background-color: #ccc;
    }

    .shade {
      width: 200px;
      height: 200px;
      position: relative;
    }

    .shade:after {
      content: '';
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
    }
  </style>
</head>

<body>
  <!-- 添加分割线 -->
  <p class="or">Or</p>
  <!-- 使用伪元素遮挡form -->
  <form action="" class="reg" id="reg" autocomplete='off'>
    <input type="text" name='username' autocomplete='off'>
    <br>
    <br>
    <input type="text" name='password' autocomplete='off'>
  </form>
  <button id='change'>点我切换遮罩</button>
  <script src="../lib/jquery-3.1.1.min.js"></script>
  <script>
    $("#change").on('click', function () {
      $("#reg").toggleClass("shade")
    })
  </script>
</body>

</html>